package com.sadhoc.router.duplicate;

import com.sadhoc.router.topology.SequenceNumber;

public class DuplicateTableEntry {
	
	private String originator;
	private SequenceNumber sequenceNumber;
	
	/*
	 * Constructor
	 */
	public DuplicateTableEntry(String originator, SequenceNumber sequenceNumber) {
		this.originator = originator;
		this.sequenceNumber = sequenceNumber;
	}
	
	/*
	 * (non-Javadoc)
	 * @see java.lang.Object#equals(java.lang.Object)
	 */
	public boolean equals(Object o) {
		DuplicateTableEntry e = (DuplicateTableEntry) o;
		return (originator.equals(e.originator) && sequenceNumber.equals(e.sequenceNumber));
	}
	
	/*
	 * generates a hash code for key generation
	 */
	public int hashCode() {
		return (originator.hashCode() + sequenceNumber.hashCode());
	}
	
	/*
	 * returns sequenceNumber
	 */ 
	public SequenceNumber getSequenceNumber() {
		return sequenceNumber;
	}
	
	/*
	 * returns the originator IP
	 */ 
	public String getOriginator() {
		return originator;
	}

}
